package qldc.pm.tiensu.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import qldc.pm.tiensu.model.KetQuaTrichLuc;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

import java.util.Date;

/**
 * The cache model class for representing KetQuaTrichLuc in entity cache.
 *
 * @author Brian Wing Shun Chan
 * @see KetQuaTrichLuc
 * @generated
 */
public class KetQuaTrichLucCacheModel implements CacheModel<KetQuaTrichLuc>,
    Externalizable {
    public long ketQuaTrichLucId;
    public long yeuCauTrichLucId;
    public String maKetQuaTrichLuc;
    public String kinhGui;
    public String tinhTrangAnTich;
    public String thongTinAnTich;
    public String toiDanh;
    public String hinhPhatChinh;
    public String hinhPhatBoSung;
    public String trinhTrangThiHanhAn;
    public String nguoiTraCuuHoSo;
    public long ngayTraCuu;
    public int ketQua;

    @Override
    public String toString() {
        StringBundler sb = new StringBundler(27);

        sb.append("{ketQuaTrichLucId=");
        sb.append(ketQuaTrichLucId);
        sb.append(", yeuCauTrichLucId=");
        sb.append(yeuCauTrichLucId);
        sb.append(", maKetQuaTrichLuc=");
        sb.append(maKetQuaTrichLuc);
        sb.append(", kinhGui=");
        sb.append(kinhGui);
        sb.append(", tinhTrangAnTich=");
        sb.append(tinhTrangAnTich);
        sb.append(", thongTinAnTich=");
        sb.append(thongTinAnTich);
        sb.append(", toiDanh=");
        sb.append(toiDanh);
        sb.append(", hinhPhatChinh=");
        sb.append(hinhPhatChinh);
        sb.append(", hinhPhatBoSung=");
        sb.append(hinhPhatBoSung);
        sb.append(", trinhTrangThiHanhAn=");
        sb.append(trinhTrangThiHanhAn);
        sb.append(", nguoiTraCuuHoSo=");
        sb.append(nguoiTraCuuHoSo);
        sb.append(", ngayTraCuu=");
        sb.append(ngayTraCuu);
        sb.append(", ketQua=");
        sb.append(ketQua);
        sb.append("}");

        return sb.toString();
    }

    @Override
    public KetQuaTrichLuc toEntityModel() {
        KetQuaTrichLucImpl ketQuaTrichLucImpl = new KetQuaTrichLucImpl();

        ketQuaTrichLucImpl.setKetQuaTrichLucId(ketQuaTrichLucId);
        ketQuaTrichLucImpl.setYeuCauTrichLucId(yeuCauTrichLucId);

        if (maKetQuaTrichLuc == null) {
            ketQuaTrichLucImpl.setMaKetQuaTrichLuc(StringPool.BLANK);
        } else {
            ketQuaTrichLucImpl.setMaKetQuaTrichLuc(maKetQuaTrichLuc);
        }

        if (kinhGui == null) {
            ketQuaTrichLucImpl.setKinhGui(StringPool.BLANK);
        } else {
            ketQuaTrichLucImpl.setKinhGui(kinhGui);
        }

        if (tinhTrangAnTich == null) {
            ketQuaTrichLucImpl.setTinhTrangAnTich(StringPool.BLANK);
        } else {
            ketQuaTrichLucImpl.setTinhTrangAnTich(tinhTrangAnTich);
        }

        if (thongTinAnTich == null) {
            ketQuaTrichLucImpl.setThongTinAnTich(StringPool.BLANK);
        } else {
            ketQuaTrichLucImpl.setThongTinAnTich(thongTinAnTich);
        }

        if (toiDanh == null) {
            ketQuaTrichLucImpl.setToiDanh(StringPool.BLANK);
        } else {
            ketQuaTrichLucImpl.setToiDanh(toiDanh);
        }

        if (hinhPhatChinh == null) {
            ketQuaTrichLucImpl.setHinhPhatChinh(StringPool.BLANK);
        } else {
            ketQuaTrichLucImpl.setHinhPhatChinh(hinhPhatChinh);
        }

        if (hinhPhatBoSung == null) {
            ketQuaTrichLucImpl.setHinhPhatBoSung(StringPool.BLANK);
        } else {
            ketQuaTrichLucImpl.setHinhPhatBoSung(hinhPhatBoSung);
        }

        if (trinhTrangThiHanhAn == null) {
            ketQuaTrichLucImpl.setTrinhTrangThiHanhAn(StringPool.BLANK);
        } else {
            ketQuaTrichLucImpl.setTrinhTrangThiHanhAn(trinhTrangThiHanhAn);
        }

        if (nguoiTraCuuHoSo == null) {
            ketQuaTrichLucImpl.setNguoiTraCuuHoSo(StringPool.BLANK);
        } else {
            ketQuaTrichLucImpl.setNguoiTraCuuHoSo(nguoiTraCuuHoSo);
        }

        if (ngayTraCuu == Long.MIN_VALUE) {
            ketQuaTrichLucImpl.setNgayTraCuu(null);
        } else {
            ketQuaTrichLucImpl.setNgayTraCuu(new Date(ngayTraCuu));
        }

        ketQuaTrichLucImpl.setKetQua(ketQua);

        ketQuaTrichLucImpl.resetOriginalValues();

        return ketQuaTrichLucImpl;
    }

    @Override
    public void readExternal(ObjectInput objectInput) throws IOException {
        ketQuaTrichLucId = objectInput.readLong();
        yeuCauTrichLucId = objectInput.readLong();
        maKetQuaTrichLuc = objectInput.readUTF();
        kinhGui = objectInput.readUTF();
        tinhTrangAnTich = objectInput.readUTF();
        thongTinAnTich = objectInput.readUTF();
        toiDanh = objectInput.readUTF();
        hinhPhatChinh = objectInput.readUTF();
        hinhPhatBoSung = objectInput.readUTF();
        trinhTrangThiHanhAn = objectInput.readUTF();
        nguoiTraCuuHoSo = objectInput.readUTF();
        ngayTraCuu = objectInput.readLong();
        ketQua = objectInput.readInt();
    }

    @Override
    public void writeExternal(ObjectOutput objectOutput)
        throws IOException {
        objectOutput.writeLong(ketQuaTrichLucId);
        objectOutput.writeLong(yeuCauTrichLucId);

        if (maKetQuaTrichLuc == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(maKetQuaTrichLuc);
        }

        if (kinhGui == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(kinhGui);
        }

        if (tinhTrangAnTich == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(tinhTrangAnTich);
        }

        if (thongTinAnTich == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(thongTinAnTich);
        }

        if (toiDanh == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(toiDanh);
        }

        if (hinhPhatChinh == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(hinhPhatChinh);
        }

        if (hinhPhatBoSung == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(hinhPhatBoSung);
        }

        if (trinhTrangThiHanhAn == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(trinhTrangThiHanhAn);
        }

        if (nguoiTraCuuHoSo == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(nguoiTraCuuHoSo);
        }

        objectOutput.writeLong(ngayTraCuu);
        objectOutput.writeInt(ketQua);
    }
}
